-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CUMULUS-3682 -- Update @cumulus/message.Granule to handle missing values in CMR metadata #3865
base: master
Are you sure you want to change the base?
Conversation
This commit adds logic in convertDateToISOStringSettingNull to - set '' as an expected null if encountered in any of the granule temporal fields handled by the Granules methods. - Handle explicit undefined values by returning them rather than attempting to date convert them (the error case for this ticket) This update should be compatible with api granule write logic in that it's preserving the intent of implicit undefined values while allowing for explicit undefineds that weren't originally part of the expected typing coming from the CMR metadata spec.
@@ -46,7 +46,7 @@ export type ApiGranuleRecord = { | |||
timestamp?: number | |||
timeToArchive?: number | |||
timeToPreprocess?: number | |||
} & PartialGranuleTemporalInfo & ParitalGranuleProcessingInfo; | |||
} & PartialGranuleTemporalInfo & PartialGranuleProcessingInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
if (date === null) return null; | ||
const convertDateToISOStringSettingNull = (date: string | null | undefined) => { | ||
if (isNil(date)) return date; | ||
if (date === '') return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good and is more explicit than something like if (!date)
but is there a case here where just checking for a falsy value with !date
falls down?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice @Jkovarik this looks very reasonable. I added a question about using your explicit checks vs. !date
but that's mainly to ensure there's not a case here that needs to be explicitly tested.
Pre-emptively approving because I don't see where this might cause issues.
This commit adds logic in convertDateToISOStringSettingNull to:
This update should be compatible with api granule write logic in that it's preserving the intent of implicit undefined values while allowing for explicit undefineds that weren't originally part of the expected typing coming from the CMR metadata spec.
Summary: Summary of changes
Addresses CUMULUS-3682
Changes
PR Checklist